/*
date:20210314 pm00:07
key:1.并列的[]没考虑，一下子就难了很多,case通过率为10.00%
2.
*/
#include<math.h>
#include <algorithm>
#include <stdio.h>
#include<iostream>
#include<sstream>
#include<stdlib.h>
using namespace std;
const int P = 10007;
void change(int& a, int& b)
{
	int k = b;
	b = a;
	a = k;
}

string digui(string s)
{
	int i;
	int i_flag = -1;
	int l_flag = -1;
	int r_flag = -1;
	//先检查内部有无|,并保证了各自的第一个出现和最后一个出现
	for (i = 0; i < s.size(); i++)
	{
		if (s[i] == '|'&&i_flag==-1)
		{
			i_flag = i;
		}
		if (s[i] == '[' && i_flag == -1)
		{
			l_flag = i;
		}
		if (s[i] == ']' )
		{
			r_flag = i;
		}
	}
	//检查i_flag变量得知|的有无及位置
	if (i_flag == -1)
	{
		//无加密，直接返回
		return s;
	}
	else
	{
		//拆成三部分
		string s1 = "";
		string s2 = "";
		string s2_1 = "";
		string s3 = "";
		for (i = 0; i < l_flag; i++)
		{
			s1 += s[i];
		}
		//中间这段代表重复的数字要处理
		for (i = i_flag+1; i < r_flag; i++)
		{
			s2 += s[i];
		}
		s2_1=digui(s2);
		//刷新一次s2
		s2 = "";
		for (i = 0; i < s[l_flag+1]-48; i++)
		{
			s2+= s2_1;
		}
		for (i = r_flag+1; i < s.size(); i++)
		{
			s3 += s[i];
		}
		//cout << s1 << " " << s2 << " " << s3 << " ";
		return s1 + s2 + s3;
	}
	
}
int main()
{
	string s;
	cin >> s;
	cout<<digui(s);
}
